﻿-- Define the relationship between Attachment and Activity
ALTER TABLE [dbo].[Attachment] WITH CHECK ADD  
       CONSTRAINT [FK_Attachment_Activity] FOREIGN KEY([Activity])
REFERENCES [dbo].[Activity] ([ActivityId])
ON DELETE NO ACTION
GO
-- Define the relationship between Attachment and Person
ALTER TABLE [dbo].[Attachment] WITH CHECK ADD  
       CONSTRAINT [FK_Attachment_Person] FOREIGN KEY([CreatedBy])
REFERENCES [dbo].[Person] ([PersonId])
ON DELETE NO ACTION
GO
-- Define the relationship between Attachment and Person
ALTER TABLE [dbo].[Attachment] WITH CHECK ADD  
       CONSTRAINT [FK_Attachment_LastChangedBy] FOREIGN KEY([LastChangedBy])
REFERENCES [dbo].[Person] ([PersonId])
ON DELETE NO ACTION
GO